﻿#region Header
// Copyright 2007-2011, Jerónimo Milea
// 
// This file is part of NetJsWire.
// 
//     NetJsWire is free software: you can redistribute it and/or modify
//     it under the terms of the GNU General Public License as published by
//     the Free Software Foundation, either version 3 of the License, or
//     (at your option) any later version.
// 
//     NetJsWire is distributed in the hope that it will be useful,
//     but WITHOUT ANY WARRANTY; without even the implied warranty of
//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//     GNU General Public License for more details.
// 
//     You should have received a copy of the GNU General Public License
//     along with NetJsWire.  If not, see <http://www.gnu.org/licenses/>.
#endregion

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing.Design;
using System.Windows.Forms;
using NetJsWire.JsonRpcHandler;
using NetJsWire.Util;
using NetJsWire.Widgets.Data;
using NetJsWire.Widgets.Ui.Form;
using NetJsWire.Widgets.Ui.Layout;
using ToolBar = NetJsWire.Widgets.Ui.ToolBar.ToolBar;

namespace NetJsWire.Widgets.Config
{
    ///<summary>
    ///  Base class for config options
    ///</summary>
    [Serializable]
    public class ComponentConfigOptions : ObservableConfigOptions
    {
        public ComponentConfigOptions( IWidget ownerWidget )
            : base( ownerWidget )
        {
        }

        #region Implemented

        private string _applyTo;

        private string _autoEl;

        private bool _autoShow;
        private string _clearCls = "x-form-clear-left";
        private string _cls;

        private string _disabledClass;

        private string _fieldLabel;
        private string _html;
        private string _itemCls;
        private string _stateEvents;
        private bool _stateFul;
        private string _stateId;
        private string _style;
        private string _tpl;
        private string _tplWriteMode = "overwrite";
        private string _xtype;

        /// <summary>
        ///   Specify the id of the element, a DOM element or an existing Element corresponding to a DIV that is already present in the document that specifies some structural markup for this component.
        ///   Description :
        ///   When applyTo is used, constituent parts of the component can also be specified by id or CSS class name within the main element, and the component being created may attempt to create its subcomponents from that markup if applicable.
        ///   Notes :
        ///   When using this config, a call to render() is not required.
        ///   If applyTo is specified, any value passed for renderTo will be ignored and the target element's parent node will automatically be used as the component's container.
        /// </summary>
        [Description( "Specify the id of the element, a DOM element or an existing Element corresponding to a DIV that is already present in the document that specifies some structural markup for this component." )]
        [DefaultValue( ( string ) null )]
        [Browsable( true )]
        public override string ApplyTo
        {
            get { return _applyTo; }
            set
            {
                SetValue( "applyTo", value, null, _applyTo );
                _applyTo = value;
            }
        }

        /// <summary>
        ///   A tag name or DomHelper spec used to create the Element which will encapsulate this Component.
        ///   You do not normally need to specify this. For the base classes Ext.Component, Ext.BoxComponent, and Ext.Container, this defaults to 'div'. The more complex Ext classes use a more complex DOM structure created by their own onRender methods.
        ///   This is intended to allow the developer to create application-specific utility Components encapsulated by different DOM elements. Example usage:
        ///   {
        ///   xtype: 'box',
        ///   autoEl: {
        ///   tag: 'img',
        ///   src: 'http://www.example.com/example.jpg'
        ///   }
        ///   }, {
        ///   xtype: 'box',
        ///   autoEl: {
        ///   tag: 'blockquote',
        ///   html: 'autoEl is cool!'
        ///   }
        ///   }, {
        ///   xtype: 'container',
        ///   autoEl: 'ul',
        ///   cls: 'ux-unordered-list',
        ///   items: {
        ///   xtype: 'box',
        ///   autoEl: 'li',
        ///   html: 'First list item'
        ///   }
        ///   }
        /// </summary>
        [Description( "A tag name or DomHelper spec used to create the Element which will encapsulate this Component." )]
        [DefaultValue( ( string ) null )]
        [Browsable( true )]
        public override string AutoEl
        {
            get { return _autoEl; }
            set
            {
                SetValue( "autoEl", value, null, _autoEl );
                _autoEl = value;
            }
        }

        /// <summary>
        ///   True if the component should check for hidden classes (e.g. 'x-hidden' or 'x-hide-display') and remove them on render (defaults to false).
        /// </summary>
        [Description( "True if the component should check for hidden classes (e.g. 'x-hidden' or 'x-hide-display') and remove them on render (defaults to false)." )]
        [DefaultValue( false )]
        [Browsable( true )]
        public override bool AutoShow
        {
            get { return _autoShow; }
            set
            {
                SetValue( "activeItem", value, false, _autoShow );
                _autoShow = value;
            }
        }

        /// <summary>
        ///   CSS class added to the component when it is disabled (defaults to 'x-item-disabled').
        /// </summary>
        [Description( "CSS class added to the component when it is disabled (defaults to 'x-item-disabled')." )]
        [DefaultValue( ( string ) null )]
        [Browsable( true )]
        public override string DisabledClass
        {
            get { return _disabledClass; }
            set
            {
                SetValue( "disabledClass", value, null, _disabledClass );
                _disabledClass = value;
            }
        }

        /// <summary>
        ///   The label text to display next to this Component (defaults to '').
        ///   Note: this config is only used when this Component is rendered by a Container which has been configured to use the FormLayout layout manager (e.g. Ext.form.FormPanel or specifying layout:'form').
        ///   Also see hideLabel and Ext.layout.FormLayout.fieldTpl.
        ///   Example use:
        ///   new Ext.FormPanel({
        ///   height: 100,
        ///   renderTo: Ext.getBody(),
        ///   items: [{
        ///   xtype: 'textfield',
        ///   fieldLabel: 'Name'
        ///   }]
        ///   });
        /// </summary>
        [Description( "The label text to display next to this Component (defaults to '')." )]
        [DefaultValue( ( string ) null )]
        [Browsable( true )]
        public override string FieldLabel
        {
            get { return _fieldLabel; }
            set
            {
                if ( OwnerWidget is IFormField )
                {
                    SetValue( "fieldLabel", value, null, _fieldLabel );
                }
                _fieldLabel = value;
            }
        }

        /// <summary>
        ///   The CSS class used to to apply to the special clearing div rendered directly after each form field wrapper to provide field clearing (defaults to <c>'x-form-clear-left'</c>).
        ///   <remarks>
        ///     Note: this config is only used when this Component is rendered by a Container which has been configured to use the FormLayout layout manager 
        ///     (e.g. <c>Ext.form.FormPanel</c> or specifying <c>layout:'form'</c>) and either a fieldLabel is specified or isFormField=true is specified.
        ///   </remarks>
        /// </summary>
        [Description( "The CSS class used to to apply to the special clearing div rendered directly after each form field wrapper to provide field clearing (defaults to 'x-form-clear-left')." )]
        [DefaultValue( "x-form-clear-left" )]
        [Browsable( true )]
        public override string ClearCls
        {
            get { return _clearCls; }
            set
            {
                SetValue( "clearCls", value, "x-form-clear-left", _clearCls );
                _clearCls = value;
            }
        }

        /// <summary>
        ///   An optional extra CSS class that will be added to this component's Element (defaults to ''). 
        ///   This can be useful for adding customized styles to the component or any of its children using standard CSS rules.
        /// </summary>
        [Description( "An optional extra CSS class that will be added to this component's Element (defaults to '')." )]
        [DefaultValue( ( string ) null )]
        [Browsable( true )]
        public override string Cls
        {
            get { return _cls; }
            set
            {
                SetValue( "cls", value, null, _cls );
                _cls = value;
            }
        }

        /// <summary>
        ///   An HTML fragment, or a DomHelper specification to use as the layout element content (defaults to '').
        ///   <remarks>
        ///     The HTML content is added after the component is rendered, so the document will not contain this HTML at the time the render event is fired. This content is inserted into the body before any configured contentEl is appended.
        ///   </remarks>
        /// </summary>
        [Description( "An HTML fragment, or a DomHelper specification to use as the layout element content (defaults to '')." )]
        [DefaultValue( ( string ) null )]
        [Browsable( true )]
        public override string Html
        {
            get { return _html; }
            set
            {
                SetValue( "html", value, null, _html );
                _html = value;
            }
        }

        /// <summary>
        ///   An additional CSS class to apply to the div wrapping the form item element of this field. If supplied, itemCls at the field level will override the default itemCls supplied at the container level. The value specified for itemCls will be added to the default class ('x-form-item').
        ///   Since it is applied to the item wrapper (see Ext.layout.FormLayout.fieldTpl), it allows you to write standard CSS rules that can apply to the field, the label (if specified), or any other element within the markup for the field.
        ///   <remarks>
        ///     This config is only used when this Component is rendered by a Container which has been configured to use the FormLayout layout manager (e.g. Ext.form.FormPanel or specifying layout:'form').
        ///   </remarks>
        /// </summary>
        [Description( "An additional CSS class to apply to the div wrapping the form item element of this field." )]
        [DefaultValue( ( string ) null )]
        [Browsable( true )]
        public override string ItemCls
        {
            get { return _itemCls; }
            set
            {
                SetValue( "itemCls", value, null, _itemCls );
                _itemCls = value;
            }
        }

        /// <summary>
        ///   An array of events that, when fired, should trigger this component to save its state (defaults to none).
        ///   <remarks>
        ///     stateEvents may be any type of event supported by this component, including browser or custom events (e.g., ['click', 'customerchange']).
        ///   </remarks>
        ///   See <see cref = "StateFul" /> for an explanation of saving and restoring Component state.
        /// </summary>
        [Description( "An array of events that, when fired, should trigger this component to save its state (defaults to none)." )]
        [DefaultValue( ( string ) null )]
        [Browsable( true )]
        public override string StateEvents
        {
            get { return _stateEvents; }
            set
            {
                SetValue( "stateEvents", value, null, _stateEvents );
                _stateEvents = value;
            }
        }

        /// <summary>
        ///   The unique id for this component to use for state management purposes (defaults to the component id if one was set, otherwise null if the component is using a generated id).
        /// </summary>
        [Description( "The unique id for this component to use for state management purposes (defaults to the component id if one was set, otherwise null if the component is using a generated id)." )]
        [DefaultValue( ( string ) null )]
        [Browsable( true )]
        public override string StateId
        {
            get { return _stateId; }
            set
            {
                SetValue( "stateId", value, null, _stateId );
                _stateId = value;
            }
        }

        /// <summary>
        ///   A flag which causes the Component to attempt to restore the state of internal properties from a saved state on startup.
        ///   The component must have either a stateId or id assigned for state to be managed. Auto-generated ids are not guaranteed to be stable across page loads and cannot be relied upon to save and restore the same state for a component.
        ///   <remarks>
        ///     For state saving to work, the state manager's provider must have been set to an implementation of Ext.state.Provider which overrides the set and get methods to save and recall name/value pairs. A built-in implementation, Ext.state.CookieProvider is available.
        ///     To set the state provider for the current page:
        ///     <code>
        ///       Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
        ///       expires: new Date(new Date().getTime()+(1000*60*60*24*7)), //7 days from now
        ///       }));
        ///     </code>
        ///     A stateful Component attempts to save state when one of the events listed in the stateEvents configuration fires.
        ///     To save state, a stateful Component first serializes its state by calling getState. By default, this function does nothing. The developer must provide an implementation which returns an object hash which represents the Component's restorable state.
        ///     The value yielded by getState is passed to Ext.state.Manager.set which uses the configured Ext.state.Provider to save the object keyed by the Component's stateId, or, if that is not specified, its id.
        ///     During construction, a stateful Component attempts to restore its state by calling Ext.state.Manager.get passing the stateId, or, if that is not specified, the id.
        ///     The resulting object is passed to applyState. The default implementation of applyState simply copies properties into the object, but a developer may override this to support more behaviour.
        ///     You can perform extra processing on state save and restore by attaching handlers to the beforestaterestore, staterestore, beforestatesave and statesave events.
        ///   </remarks>
        /// </summary>
        [Description( "A flag which causes the Component to attempt to restore the state of internal properties from a saved state on startup." )]
        [DefaultValue( false )]
        [Browsable( true )]
        public override bool StateFul
        {
            get { return _stateFul; }
            set
            {
                SetValue( "stateFul", value, false, _stateFul );
                _stateFul = value;
            }
        }

        /// <summary>
        ///   A custom style specification to be applied to this component's Element. Should be a valid argument to Ext.Element.applyStyles.
        ///   <example>
        ///     new Ext.Panel({
        ///     title: 'Some Title',
        ///     renderTo: Ext.getBody(),
        ///     width: 400, height: 300,
        ///     layout: 'form',
        ///     items: [{
        ///     xtype: 'textarea',
        ///     style: {
        ///     width: '95%',
        ///     marginBottom: '10px'
        ///     }
        ///     },
        ///     new Ext.Button({
        ///     text: 'Send',
        ///     minWidth: '100',
        ///     style: {
        ///     marginBottom: '10px'
        ///     }
        ///     })
        ///     ]
        ///     });
        ///   </example>
        /// </summary>
        [Description( "A custom style specification to be applied to this component's Element. Should be a valid argument to Ext.Element.applyStyles." )]
        [DefaultValue( ( string ) null )]
        [Browsable( true )]
        public override string Style
        {
            get { return _style; }
            set
            {
                SetValue( "style", value, null, _style );
                _style = value;
            }
        }

        /// <summary>
        ///   An Ext.Template, Ext.XTemplate or an array of strings to form an Ext.XTemplate. Used in conjunction with the data and tplWriteMode configurations.
        /// </summary>
        [Description( "An Ext.Template, Ext.XTemplate or an array of strings to form an Ext.XTemplate. Used in conjunction with the data and tplWriteMode configurations." )]
        [DefaultValue( ( string ) null )]
        [Browsable( true )]
        [Editor( typeof( MultilineStringEditor ), typeof( UITypeEditor ) )]
        public override string Tpl
        {
            get { return _tpl; }
            set
            {
                SetValue( "tpl", value, null, _tpl );
                _tpl = value;
            }
        }

        /// <summary>
        ///   The Ext.(X)Template method to use when updating the content area of the Component. Defaults to 'overwrite' (see Ext.XTemplate.overwrite).
        /// </summary>
        [Description( "The Ext.(X)Template method to use when updating the content area of the Component. Defaults to 'overwrite'." )]
        [DefaultValue( "overwrite" )]
        [Browsable( true )]
        public override string TplWriteMode
        {
            get { return _tplWriteMode; }
            set
            {
                SetValue( "tplWriteMode", value, "overwrite", _tplWriteMode );
                _tplWriteMode = value;
            }
        }

        /// <summary>
        ///   The registered xtype to create.
        ///   This config option is not used when passing a config object into a constructor.
        ///   This config option is used only when lazy instantiation is being used, and a child item of a Container is being specified not as a fully instantiated Component, but as a Component config object.
        ///   The xtype will be looked up at render time up to determine what type of child Component to create.
        /// </summary>
        [Description( "The registered xtype to create. This config option is not used when passing a config object into a constructor." )]
        [DefaultValue( ( string ) null )]
        [Browsable( true )]
        [TypeConverter( typeof( XtypeStringConverter ) )]
        public override string Xtype
        {
            get { return _xtype; }
            set
            {
                SetValue( "xtype", value, null, _xtype );
                _xtype = value;
                if ( !string.IsNullOrWhiteSpace( _xtype ) )
                {
                    OwnerWidget.Renderer.SetAttribute( "xtype", _xtype );
                }
            }
        }

        #endregion Implemented

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool AnimCollapse { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool AutoHeight { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string AutoLoad { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string BaseCls { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override ToolBar BottomBar { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string BottomBarCfg { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool BodyBorder { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string BodyCfg { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string BodyCssClass { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string BodyStyle { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool Border { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( ButtonAlign.Right )]
        public override ButtonAlign ButtonAlign { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string BwrapCfg { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool Closable { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool CollapseFirst { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool Collapsed { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool Collapsible { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool Unstyled { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool AutoScroll { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool AutoWidth { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override int? BoxMaxHeight { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override int? BoxMaxWidth { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override int? BoxMinHeight { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override int? BoxMinWidth { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override Padding Margins { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string Region { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override object ActiveItem { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool AutoDestroy { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( ( string ) null )]
        public override string BubbleEvents { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override int? BufferResize { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string Defaults { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool ForceLayout { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool HideBorders { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override bool? MonitorResize { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string ResizeEvent { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( LayoutType.Auto )]
        public override LayoutType Layout { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string LayoutConfig { get; set; }

        /// <summary>
        ///   An object or array of objects that will provide custom functionality for this component.
        ///   The only requirement for a valid plugin is that it contain an init method that accepts a reference of type Ext.Component.
        ///   When a component is created, if any plugins are available, the component will call the init method on each plugin, passing a reference to itself.
        ///   Each plugin can then call methods or respond to events on the component as needed to provide its functionality.
        /// </summary>
        [Description( "An object or array of objects that will provide custom functionality for this component." )]
        [Browsable( true )]
        [Editor( typeof( ListStringCollectionEditor ), typeof( UITypeEditor ) )]
        public override List<object> Plugins
        {
            get { return OwnerWidget.Renderer.Plugins; }
        }

        #region Store

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool AutoSave { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override List<BaseParam> BaseParams { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool Batch { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override ParamNames DefaultParamNames { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override ParamNames ParamNames { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override DataProxy Proxy { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool PruneModifiedRecords { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override DataReader Reader { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool RemoteSort { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( false )]
        public override bool RestFul { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override SortInfo SortInfo { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string StoreId { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string Url { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override DataWriter Writer { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( 0 )]
        public override int IdIndex { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string IdProperty { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string Root { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string SuccessProperty { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string TotalProperty { get; set; }

        #endregion Store

        #region Field

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string FieldClass { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string FocusClass { get; set; }

        [Browsable( false ), EditorBrowsable( EditorBrowsableState.Never )]
        [DefaultValue( null )]
        public override string Name { get; set; }

        #endregion

        public bool ShouldSerializePlugins()
        {
            return Plugins != null && Plugins.Count > 0;
        }
    }
}